import { fetchUserFeed } from '@/lib/api/account/profile';
import FeedList from '@/app/(main)/feed/_component/FeedList';

type Props = {
	params: Promise<{ sid: string }>;
};

export default async function UserProfileFeedPage({ params }: Props) {
	const { sid } = await params;
	const res = await fetchUserFeed(sid, 1, 20);
	const data = res.data ?? { total: 0, list: [], authorSID: sid, authorName: '' };

	return (
		<FeedList
			initialCards={data.list}
			initialTotal={data.total}
			endpoint={`/api/member/${encodeURIComponent(sid)}/feed`}
			emptyMessage="작성한 피드가 없습니다."
		/>
	);
}